package com.walk.zworld.ui.location;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.fragment.app.FragmentActivity;

import com.walk.zworld.R;
import com.walk.zworld.utils.ResourceUtil;

public class LoactionDetailProgressViewHelper {
    private TextView mBtnWaitPay;
    private TextView mBtnWaitDelivered;
    private TextView mBtnWaitReceived;
    private TextView mBtnWaitEvaluated;
    private TextView mBtnCompeleted;
    private ImageView mPointWaitPay;
    private ImageView mPointWaitDelivered;
    private ImageView mPointWaitReceived;
    private ImageView mPointWaitEvaluated;
    private ImageView mPointCompeleted;

    private Drawable mDefaultDrawable;
    private Drawable mSelectDrawable;
    private int mDefaultTextColor;
    private int mSelectTextColor;
    int lastState = 0;
    protected void initView(FragmentActivity activity, ViewGroup contentView) {
        mBtnWaitPay = (TextView) contentView.findViewById(R.id.btn_wait_pay);
        mBtnWaitDelivered = (TextView) contentView.findViewById(R.id.btn_wait_delivered);
        mBtnWaitReceived = (TextView) contentView.findViewById(R.id.btn_wait_received);
        mBtnWaitEvaluated = (TextView) contentView.findViewById(R.id.btn_wait_evaluated);
        mBtnCompeleted = (TextView) contentView.findViewById(R.id.btn_compeleted);
        mPointWaitPay = (ImageView) contentView.findViewById(R.id.point_wait_pay);
        mPointWaitDelivered = (ImageView) contentView.findViewById(R.id.point_wait_delivered);
        mPointWaitReceived = (ImageView) contentView.findViewById(R.id.point_wait_received);
        mPointWaitEvaluated = (ImageView) contentView.findViewById(R.id.point_wait_evaluated);
        mPointCompeleted = (ImageView) contentView.findViewById(R.id.point_compeleted);
        mDefaultDrawable = ResourceUtil.getDrawable(R.drawable.icon_order_status_default,false);
        mSelectDrawable = ResourceUtil.getDrawable(R.drawable.icon_order_status_select,false);
        mDefaultTextColor = ResourceUtil.getColor(activity, R.color.color_333);
        mSelectTextColor = ResourceUtil.getColor(activity, R.color.color_FF5121);
    }

    public int getLastState() {
        return lastState;
    }

    public void setStatus(int status){
        lastState = status;
        switch (status){
            case -1:
                mBtnWaitPay.setTextColor(mDefaultTextColor);
                mBtnWaitDelivered.setTextColor(mDefaultTextColor);
                mBtnWaitReceived.setTextColor(mDefaultTextColor);
                mBtnWaitEvaluated.setTextColor(mDefaultTextColor);
                mBtnCompeleted.setTextColor(mDefaultTextColor);

                mPointWaitPay.setImageDrawable(mDefaultDrawable);
                mPointWaitDelivered.setImageDrawable(mDefaultDrawable);
                mPointWaitReceived.setImageDrawable(mDefaultDrawable);
                mPointWaitEvaluated.setImageDrawable(mDefaultDrawable);
                mPointCompeleted.setImageDrawable(mDefaultDrawable);
                break;
            case 0:
                mBtnWaitPay.setTextColor(mSelectTextColor);
                mBtnWaitDelivered.setTextColor(mDefaultTextColor);
                mBtnWaitReceived.setTextColor(mDefaultTextColor);
                mBtnWaitEvaluated.setTextColor(mDefaultTextColor);
                mBtnCompeleted.setTextColor(mDefaultTextColor);

                mPointWaitPay.setImageDrawable(mSelectDrawable);
                mPointWaitDelivered.setImageDrawable(mDefaultDrawable);
                mPointWaitReceived.setImageDrawable(mDefaultDrawable);
                mPointWaitEvaluated.setImageDrawable(mDefaultDrawable);
                mPointCompeleted.setImageDrawable(mDefaultDrawable);
                break;
            case 1:
                mBtnWaitPay.setTextColor(mSelectTextColor);
                mBtnWaitDelivered.setTextColor(mSelectTextColor);
                mBtnWaitReceived.setTextColor(mDefaultTextColor);
                mBtnWaitEvaluated.setTextColor(mDefaultTextColor);
                mBtnCompeleted.setTextColor(mDefaultTextColor);

                mPointWaitPay.setImageDrawable(mSelectDrawable);
                mPointWaitDelivered.setImageDrawable(mSelectDrawable);
                mPointWaitReceived.setImageDrawable(mDefaultDrawable);
                mPointWaitEvaluated.setImageDrawable(mDefaultDrawable);
                mPointCompeleted.setImageDrawable(mDefaultDrawable);

                break;
            case 2:
                mBtnWaitPay.setTextColor(mSelectTextColor);
                mBtnWaitDelivered.setTextColor(mSelectTextColor);
                mBtnWaitReceived.setTextColor(mSelectTextColor);
                mBtnWaitEvaluated.setTextColor(mDefaultTextColor);
                mBtnCompeleted.setTextColor(mDefaultTextColor);

                mPointWaitPay.setImageDrawable(mSelectDrawable);
                mPointWaitDelivered.setImageDrawable(mSelectDrawable);
                mPointWaitReceived.setImageDrawable(mSelectDrawable);
                mPointWaitEvaluated.setImageDrawable(mDefaultDrawable);
                mPointCompeleted.setImageDrawable(mDefaultDrawable);
                break;
            case 3:
                mBtnWaitPay.setTextColor(mSelectTextColor);
                mBtnWaitDelivered.setTextColor(mSelectTextColor);
                mBtnWaitReceived.setTextColor(mSelectTextColor);
                mBtnWaitEvaluated.setTextColor(mSelectTextColor);
                mBtnCompeleted.setTextColor(mDefaultTextColor);

                mPointWaitPay.setImageDrawable(mSelectDrawable);
                mPointWaitDelivered.setImageDrawable(mSelectDrawable);
                mPointWaitReceived.setImageDrawable(mSelectDrawable);
                mPointWaitEvaluated.setImageDrawable(mSelectDrawable);
                mPointCompeleted.setImageDrawable(mDefaultDrawable);
                break;
            case 4:
                mBtnWaitPay.setTextColor(mSelectTextColor);
                mBtnWaitDelivered.setTextColor(mSelectTextColor);
                mBtnWaitReceived.setTextColor(mSelectTextColor);
                mBtnWaitEvaluated.setTextColor(mSelectTextColor);
                mBtnCompeleted.setTextColor(mSelectTextColor);

                mPointWaitPay.setImageDrawable(mSelectDrawable);
                mPointWaitDelivered.setImageDrawable(mSelectDrawable);
                mPointWaitReceived.setImageDrawable(mSelectDrawable);
                mPointWaitEvaluated.setImageDrawable(mSelectDrawable);
                mPointCompeleted.setImageDrawable(mSelectDrawable);
                break;
            default:
                break;
        }
    }
}
